package com.hujiang.basic.search.common.converter.req;

import com.hujiang.basic.search.common.converter.Converter;
import com.hujiang.basic.search.model.HJPartialUpdateRequest;
import com.hujiang.basic.search.model.HJUpdateRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.springframework.stereotype.Component;

/**
 * Created by zhanglibin on 2017/4/19.
 */
@Component
public class PartialUpdateRequestConverter implements Converter<HJPartialUpdateRequest, UpdateRequest> {

    @Override
    public UpdateRequest convert(HJPartialUpdateRequest in) {
        return new UpdateRequest(in.getIndex(), in.getType(), in.getId()).doc(in.getSource());
    }
}
